package the.guanzhong.express.infrastructure.common.enums;

import lombok.Getter;

import java.util.Arrays;

/**
 * 售后状态
 */
public enum RefundStatusEnum {

    WAITING_AUDIT(10, "待审核"),
    WAITING_REFUND(20, "退款中"),
    REFUNDED(90, "已退款"),
    REJECTED(91, "已拒绝");

    RefundStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    @Getter
    private Integer code;

    @Getter
    private String name;

    public static String getName(Integer code) {
        return Arrays.stream(RefundStatusEnum.values()).filter(it -> it.getCode().equals(code)).findFirst().get().getName();
    }
}
